package excercise;

import java.util.Scanner;

public class EX01_Q23_ {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		//문제 26
		int keyY;
		int keyM;
		keyY = (int)(Math.random()*100 );
		
		System.out.println("1~100숫자를 입력해보세요.");
		do{
		    Scanner sc = new Scanner(System.in); 	
			keyM = sc.nextInt();
			if (keyM == keyY) {System.out.println("빙고! 추측한숫자를 맞췄습니다");}
			else if(keyM < keyY){System.out.println("추측한 숫자가 작습니다");}
			else {System.out.println("추측한 숫자가 큽니다");}
		   }
		while(keyM != keyY);
		
		//문제 23
		Scanner dc = new Scanner(System.in);  
		System.out.println("1~10에서 3개 뽑아봐");
		int[] keyMy = new int[2];
		for(int i = 1; i< keyMy.length; ++i)
			keyMy[i] = dc.nextInt(); 
		int[] keyYu = new int[2];
		for(int i = 0; i < keyYu.length; ++i)
			keyYu[i] = (int)(Math.random()*10 + 1);
		
		if(keyMy == keyYu){
			System.out.println("상금 1백만원 지급");}
		else if(keyMy[0] == keyYu[0] && keyMy[1] == keyYu[1] || keyMy[2] == keyYu[2]){
			System.out.println("상금 1만 지급");}
		else if(keyMy[0] == keyYu[0] || keyMy[1] == keyYu[1] && keyMy[2] == keyYu[2]){
			System.out.println("상금 1만 지급");}
		else if(keyMy[0] == keyYu[0] || keyMy[1] == keyYu[1] || keyMy[2] == keyYu[2])
			{System.out.println("상금 1천 지급");}
		else {System.out.println("틀렸어용!");
		}
		System.out.print("추첨번호 :");
		for (int i = 1; i <=3; ++i){
			System.out.print(keyYu[i] + "\t");
		System.out.println("\n 복권번호 :");
			System.out.println(keyMy[i] + "\t" );
		}
	}

}
